<?php

/**
 * ofertas actions. Gestiona viviendas en oferta
 *
 * @package    costabravasfr
 * @subpackage ofertas
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class ofertasActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex(sfWebRequest $request)
  {
	//Muestra listado de viviendas alquiler con precios en oferta
    $query = Doctrine_Query::create()->select("DISTINCT v.*, MIN(p.precio_euros_oferta) as minOferta")->from('ViviendasAlquileres v')->leftJoin('v.AlquileresPrecios p')->where('p.precio_euros_oferta != ?', '')->orWhere('p.precio_dia_oferta != ?', '')->orderBy('v.orderid')->groupBy('v.id');
	$this->pager = new sfDoctrinePager('ViviendasAlquileres', sfConfig::get('app_max_locations_per_page'));
	$this->pager->setPage($request->getParameter('page', 1));
	$this->getResponse()->setTitle(sfContext::getInstance()->getI18N()->__('lastOffers', null, 'messages')." | Costa Brava | Begur Holidays");
	$this->pager->setQuery($query);
	$this->pager->init();
  }
}
